using AutoMapper;
using SmartLink.Domain.Entity;
using SmartLink.Domain.ExpandEntity;
using SmartLink.Domain.ExpandEntity.Parking;
using SmartLink.DTOS.Order;
using SmartLink.DTOS.Parking;
using SmartLink.EnumLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SmartLink.EnumLibrary.ParkingEnum;

namespace SmartLink.Infrastructure.Mappers
{
    public class ParkingToDtoProfile : Profile
    {
        public ParkingToDtoProfile()
        {
            CreateMap<ParkingLotInfoExpand, ParkingLotInfoDTO>().ForMember(d => d.ChargeTypeDesc, opt => opt.MapFrom(item => ((ChargeTypeEnum)item.ChargeType)));

            CreateMap<ParkingLotDTO, PL_ParkingLot>();
            CreateMap<PLParkingLotChargeDTO, PL_ParkingLotCharge>();
            CreateMap<ParkingLotDetailExpand, AppParkingLotDetailDTO>();
            CreateMap<PL_ParkingLotCharge, ParkingLotChargeDTO>();
            CreateMap<PLParkingLotChargeDTO, PL_ParkingLotCharge>();
            CreateMap<ParkingLotDetailExpand, ParkingLotDetailDTO>()
              .ForMember(d => d.ChargeTypeDesc, opt => opt.MapFrom(item => ((ChargeTypeEnum)item.ChargeType)))
              .ForMember(d => d.IsCapDesc, opt => opt.MapFrom(item => item.IsCap == true ? "封顶" : "不封顶"));

            CreateMap<PL_ParkingLot, ParkingDTO>();
            CreateMap<PL_ParkingLot, SingleParkingDTO>()
               .ForMember(d => d.ChargeTypeDesc, opt => opt.MapFrom(item => ((ChargeTypeEnum)item.ChargeType)))
              .ForMember(d => d.IsCapDesc, opt => opt.MapFrom(item => item.IsCap == true ? "封顶" : "不封顶")); ;
            CreateMap<ParkingDTO, PL_ParkingLot>();
            CreateMap<ParkingSpaceListExpand,ParkingSpaceDTO>()
                .ForMember(d => d.StatusDesc,opt => opt.MapFrom(item => (ParkingSpaceStatusEnum)item.Status));

            CreateMap<AppointmentRecordExpand, AppointmentRecordDTO>()
                 .ForMember(d => d.AppointmentStatusDesc, opt => opt.MapFrom(item => (ParkingStatusEnum)item.AppointmentStatus)); ;

        }
    }
}
